package com.tony.blog.server.controller.web;

import com.tony.blog.server.shiro.ShiroUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: IndexWebController
 * @Auther: 皮蛋布丁
 * @Date: 2021/08/15/22:10
 * @Description: 页面模板引擎的渲染(页面跳转由后端负责 - 架构1.0)
 */
@Controller
public class IndexWebController {
    //首页
    @RequestMapping(value = {"/"},method = RequestMethod.GET)
    public String index() throws Exception {
        return "web/index";
    }

    /**
    * @Description: indexWebBlogs 我的博文
    * @Param: []
    * @return: java.lang.String
    * @Author: 皮蛋布丁
    * @Date: 2021/9/10 15:45
    */
    @RequestMapping(value = {"web/blogs"},method = RequestMethod.GET)
    public String indexWebBlogs() {
        if (null == ShiroUtil.getUserEntity()) {
            return "redirect:/login.html";
        }
        return "web/blogs";
    }

    /**
    * @Description: indexWebPraises 我的点赞博文
    * @Param: []
    * @return: java.lang.String
    * @Author: 皮蛋布丁
    * @Date: 2021/9/10 15:58
    */
    @RequestMapping(value = {"web/praises"},method = RequestMethod.GET)
    public String indexWebPraises() {
        if (null == ShiroUtil.getUserEntity()) {
            return "redirect:/login.html";
        }
        return "web/praises";
    }

    /**
    * @Description: indexWebcollects 我收藏的博文
    * @Param: []
    * @return: java.lang.String
    * @Author: 皮蛋布丁
    * @Date: 2021/9/16 10:35
    */
    @RequestMapping(value = {"web/collects"},method = RequestMethod.GET)
    public String indexWebcollects() {
        if (null == ShiroUtil.getUserEntity()) {
            return "redirect:/login.html";
        }
        return "web/collects";
    }

    /**
    * @Description: indexWebFriends 我的朋友圈
    * @Param: []
    * @return: java.lang.String
    * @Author: 皮蛋布丁
    * @Date: 2021/9/16 11:07
    */
    @RequestMapping(value = {"web/friends"},method = RequestMethod.GET)
    public String indexWebFriends() {
        if (null == ShiroUtil.getUserEntity()) {
            return "redirect:/login.html";
        }
        return "web/friends";
    }

    /**
    * @Description: indexWebCenter 首页个人中心 -- 个人信息、我的博文、我赞的博文、我的收藏、我的好友圈
    * @Param: []
    * @return: java.lang.String
    * @Author: 皮蛋布丁
    * @Date: 2021/9/23 21:28
    */
    @RequestMapping(value = {"web/center"},method = RequestMethod.GET)
    public String indexWebCenter() {
        if (null == ShiroUtil.getUserEntity()) {
            return "redirect:/login.html";
        }
        return "web/center";
    }

}
